FROM registry.cn-hangzhou.aliyuncs.com/yuanli123/golang:1.20 as build
WORKDIR /app
ARG GOOS=linux
ARG GOARCH=arm64
COPY . .
RUN go mod download
RUN GOOS=$GOOS GOARCH=$GOARCH go build -o /app/myapp

FROM registry.cn-hangzhou.aliyuncs.com/yuanli1234/debian:bookworm-slim
WORKDIR /app
COPY --from=build /app /app

EXPOSE 8081
CMD ["/app/myapp"]